import { _decorator, Button, Component, Node } from 'cc';
import { BaseComponent, cat } from '../../../Test';

const { ccclass, property } = _decorator;

@ccclass('MatchLoading')
export class MatchLoading extends BaseComponent {
    @property({ type: Button, tooltip: '取消匹配按钮' })
    btn_cancel: Button

    protected override initUI(): void {
        this.btn_cancel.node.on(Button.EventType.CLICK, this.onCancelHandler, this)
    }

    protected override onLoad(): void {
    }

    override onDestroy(): void {

    }

    // @AudioEffect()
    private onCancelHandler() {
        if (cat.store.room.roomInfo.id) {
            LeaveRoom()
        } else {
            cat.gui.loadScene('lobby')
        }

    }


}


